package earley;

public class Symbol {
	final String name;
	final boolean isTerminal;
	public Symbol(String name, boolean isTerminal) {
		this.name = name;
		this.isTerminal = isTerminal;
	}
	
	@Override
	public boolean equals(Object obj) {
		if (!(obj instanceof Symbol)) {
			return false;
		}
		Symbol s = (Symbol) obj;
		return s.name.equals(name) && s.isTerminal == isTerminal;
	}
	
	@Override
	public String toString() {
		if (isTerminal) {
			return name;
		}
		return "<" + name + ">";
	}
}
